//连接数据库
const mysql = require('mysql');
const cfg = {
    host: '106.12.116.32',
    user: 'root',
    password: 'ace5113@163.com',
    database: 'sure'
};

//连接池
const pool = mysql.createPool(cfg);

module.exports = {
    query: function (sql, value) {
        return new Promise((resolve, reject) => {
            pool.query(sql, value, (err, results) => {
                if (err) reject(err);
                else resolve(results);
            });
        });
    },
    pool
};